import Cookies from 'js-cookie'

const TokenKey = 'dami_admin_token'
const RefreshTokenKey = 'dami_admin_refresh_token'

export function getToken(keys='token') {
  if (keys == 'refresh'){
    return Cookies.get(RefreshTokenKey)
  }else{
    return Cookies.get(TokenKey)
  }

}

export function setToken(token,keys='token') {
  if (keys == 'refresh'){
    return Cookies.set(RefreshTokenKey, token)
  }else{
    return Cookies.set(TokenKey, token)
  }
}

export function removeToken(keys='all') {
  if (keys == 'token'){
    return Cookies.remove(TokenKey)
  }else if(keys == 'refresh'){
    return Cookies.remove(RefreshTokenKey)
  }
  Cookies.remove(TokenKey)
  return Cookies.remove(RefreshTokenKey)
}